package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

/**
 *  药物列表请求类 
 *
 * @author hongyuhao
 * @version 2014年5月27日 - 上午10:26:31
 */
public class UserDrugListRequest extends Request {

	private static final long serialVersionUID = 613241715474519814L;
	
	private int type;
	private int category;
	private int pageSize;
	private int pageNum;
	
	
	@Override
	public void parse(HttpServletRequest request) {
		
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		
		category = requestInfo.getIntParameter(ApiUrlParamEnum.dcategory.getParamName(), -1);
		if(category == -1) {
			throw new RequestIllegalException("药物分类错误:category:" + category);
		}
		
		type = requestInfo.getIntParameter(ApiUrlParamEnum.dtype.getParamName(), -1);
		pageSize = requestInfo.getIntParameter(ApiUrlParamEnum.pageSize.getParamName(), 20);
		pageNum = requestInfo.getIntParameter(ApiUrlParamEnum.pageNo.getParamName(), 1);
	}
	

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public int getCategory() {
		return category;
	}

	public void setCategory(int category) {
		this.category = category;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}
	
}
